function InitPage() {
    var height = $(window).height();
    var width = $(window).width();
    $("#middle").height(height - 92);
    $("#nva").height(height - 106);
    $("#right").height(height - 90);
    $("#right").width(width - 260);


}

$(function () {
    InitPage();
    InitLayUI();

    $("#youbian").height($(window).height() - 70);
    $("#zezao").click(function () {
        ShowCb("hide");
        ShowUserinfo("hide");
    });
})


function SwichUrl(url,obj){
    if(url!='zhfx/ryqkfx_list'&&url!='zhfx/zfkh_list'&&url!='zhfx/dwkh_list'&&url!='zhfx/ywkhfx_list'){
        $("#right").addClass("rightbackground");
    }
    else{
        $("#right").removeClass("rightbackground");
    }
    $(obj).addClass('menu-cur');
    $(obj).siblings().removeClass('menu-cur');
    $("#iframe").attr("src",url);
    InitLayUI();
}

function SkipUrl(url){
    if(url!='zhfx/ryqkfx_list'&&url!='zhfx/zfkh_list'&&url!='zhfx/dwkh_list'&&url!='zhfx/ywkhfx_list'){
        $("#right").addClass("rightbackground");
    }
    else{
        $("#right").removeClass("rightbackground");
    }

    $("#iframe").attr("src",url);
}

var mylayui;

function InitLayUI() {
    layui.use('layer', function () {
        mylayui = layui.layer;
    })
}

function CloseOpenWindow() {
    mylayui.closeAll('iframe');
}


function InitEleUI() {
    layui.use(['element', 'carousel', 'form'], function () {
        var form = layui.form;
        var element = layui.element;

    })
}


function ShowUserinfo(flag) {
    if ($("#divopuserinfo").is(":hidden")) {
        if (!flag) {
            $("#zezao").show();
            $("#userinfomore").addClass("xuanzhuan");
            $("#divopuserinfo").slideDown();
        }
    }
    else {
        $("#userinfomore").removeClass("xuanzhuan");
        $("#divopuserinfo").slideUp();
        $("#zezao").hide();
    }

}

function ChangePwd() {
    mylayui.open({
        type: 2,
        title: '修改密码',
        shadeClose: true,
        shade: 0.5,
        area: ['400px', '200px'],
        content: 'changepwd'
    });
}

function CloseDialog(result, msg) {
    if (result > 0) {
        mylayui.msg('操作成功', {icon: 1});
        mylayui.closeAll('iframe');
    }
    else {
        if (msg) {
            mylayui.msg(msg, {icon: 0});
        } else {
            mylayui.msg('操作失败', {icon: 0});
        }
    }
}


function ShowCb(flag) {
    if ($("#youbian").is(":hidden")) {
        if (!flag) {
            $("#zezao").show();
            $("#youbian").show();
            $("#youbian").animate({width: "230px"}, 500);
        }
    }
    else {

        $("#youbian").animate({width: "0"}, 500, function () {
            $("#zezao").hide();
            $("#youbian").hide();
        });
    }

}


function ShowZheZhao() {
    if ($("#zezao").is(":hidden")) {
        $("#zezao").show();
        mylayui.load();
    }
    else {
        mylayui.closeAll('loading');
        $("#zezao").hide();
    }
}